package model;


public class Card implements Comparable<Card> {
	private final String suit;
	private final String face;
	private final int valueFace;
	private final int valueSuit;
	
	public Card(String face, String suit, int value) {
		this.face = face;
		this.suit = suit;
		this.valueFace = value;
		this.valueSuit = this.identifyValueSuit(suit);
	}
	
	private int identifyValueSuit(String suit) {
		if(suit.equals(Deck.suit[0]))
			return 4;
		else if(suit.equals(Deck.suit[1]))
			return 3;
		else if(suit.equals(Deck.suit[2]))
			return 2;
		else
			return 1;
	}
	
	public int compareTo(Card that) {
		int returnValue = that.getValueSuit()>this.valueSuit ? -1 : (that.getValueSuit()==this.valueSuit ? 0 : 1);
		if(returnValue==0)
			returnValue = that.getValueFace()>this.valueFace ? -1 : 1;
		return returnValue;
	}
	
	public String getCardName() {
		return this.face + " of " + this.suit;
	}
	public String getImageName() {
		return this.face + this.suit + ".png";
	}
	public String getSuit() {
		return suit;
	}
	public String getFace() {
		return face;
	}
	public int getValueFace() {
		return valueFace;
	}
	public int getValueSuit() {
		return valueSuit;
	}
}
